package com.tensai.study.java.newconcept.typereactiveprogram.reactor.demo;

import reactor.core.publisher.Flux;

/**
 * @author Tensai
 */
public class Test {

    public static void main(String[] args) {
        SampleSubscriber<Integer> ss = new SampleSubscriber<>();

        Flux<Integer> ints = Flux.range(1, 4);
//        Flux.generate()
        ints.doOnNext(System.out::println)
                .doOnError(error -> System.err.println("Error " + error))
                .doOnComplete(() -> System.out.println("Done"))
                .subscribe(s -> ss.request(10))
        ;
        ints.subscribe(ss);
    }
}
